<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#INCLUDE FILE="config.asp"-->

<%
CountryId = request("CountryID")
output = "<option value='select' selected='selected'>Seleccione Estado</option>"
count = 0
		sqlstring = "SELECT *  "
		sqlstring = sqlstring & " FROM dbo.State "
		sqlstring = sqlstring & " WHERE CountryID = "& CountryId
		
		set objConnect = server.createObject("ADODB.Connection")

		objConnect.Open conStr

		set TblTemp = server.createobject("ADODB.Recordset")
				
			TblTemp.Open Sqlstring, objConnect
			
			Do Until TblTemp.EOF
				StateId = TblTemp("StateID")
				Statename = TblTemp("StateName")
			
			if (StateId <> "" AND Statename <> "") then
				count = count + 1
				output = output + "<option value='"&Statename&"'>"&Statename&"</option>"
			end if
			
			TblTemp.MoveNext
			Loop
			
			if count > 0 then
				response.write(output)
			else 
				output = ""
				response.write(output)
			end if

%>